package liaocheng.shandong.latitude.caocuooo

import android.support.v7.widget.RecyclerView
import android.view.ViewGroup
import android.widget.TextView

/**
 * Created by hhc on 2017/07/09 0009.
 */

class RecyclerViewAdapter(val  items:List<String>):RecyclerView.Adapter<RecyclerViewAdapter.RecyclerViewHolder>(){
    override fun getItemCount(): Int {
        return items.size
    }

    override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): RecyclerViewHolder {
        return  RecyclerViewHolder(TextView(parent?.context))
    }

    override fun onBindViewHolder(holder: RecyclerViewHolder?, position: Int) {
        holder?.textView?.text=items[position]
    }

    class RecyclerViewHolder(val textView:TextView):RecyclerView.ViewHolder(textView)
}